var o, e = require, t = module, n = exports, i = this && this.__extends || (o = function(t, e) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(t, e) {
        t.__proto__ = e;
    } || function(t, e) {
        for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
    })(t, e);
}, function(t, e) {
    function n() {
        this.constructor = t;
    }
    o(t, e), t.prototype = null === e ? Object.create(e) : (n.prototype = e.prototype, 
    new n());
}), a = this && this.__decorate || function(t, e, n, o) {
    var i, a = arguments.length, s = a < 3 ? e : null === o ? o = Object.getOwnPropertyDescriptor(e, n) : o;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(t, e, n, o); else for (var l = t.length - 1; 0 <= l; l--) (i = t[l]) && (s = (a < 3 ? i(s) : 3 < a ? i(e, n, s) : i(e, n)) || s);
    return 3 < a && s && Object.defineProperty(e, n, s), s;
};

Object.defineProperty(n, "__esModule", {
    value: !0
});

var r = e("BuyItem"), s = e("BoxView"), c = e("ItemView"), l = e("Global"), d = e("BaseView"), u = e("SkinView"), p = e("PersonView"), h = e("EquipBoxView"), f = e("LevelView"), g = e("BgView"), m = e("AudioManager"), y = e("GideView"), v = e("GameManager"), w = e("GideModel"), b = e("PetManager"), P = e("SeasonManager"), I = e("VideoManager"), G = e("RecorderManager"), _ = e("ChristmasItemView"), A = e("NewYearItemView"), k = e("GameConfig"), M = e("GameData"), C = e("EggsManager"), D = e("ActivityManager"), S = e("DataManager"), O = e("WebManager"), R = e("UIManager"), T = e("AdManager"), x = e("OlympicManager"), L = cc._decorator, E = L.ccclass, V = L.property, N = function(e) {
    function t() {
        var t = null !== e && e.apply(this, arguments) || this;
        return t.tempBox = null, t.tempItem = null, t.tempEquip = null, t.tempChristmasItem = null, 
        t.tempNewYearItem = null, t.layout = null, t.air = null, t.top = null, t.bottom = null, 
        t.profitLabel = null, t.profitPool = new cc.NodePool(), t.combineSkeleton = null, 
        t.combinePool = new cc.NodePool(), t.startBtn = null, t.delBtn = null, t.dailyBtn = null, 
        t.levelView = null, t.personView = null, t.petView = null, t.bgView = null, t.gideView = null, 
        t.buyItem = null, t.boxs = [], t.curItem = null, t.equips = [], t.christmasItems = [], 
        t.newYearItems = [], t.combineCount = 0, t.randCount = 0, t.buyCount = 0, t.deleteBoxs = [], 
        t;
    }
    return i(t, e), t.prototype.onLoad = function() {
        try {
            R.default.getInstance().addPnl(this.text, this), R.default.getInstance().addPnl(this.gideView.text, this.gideView);
            for (var t = Math.floor(this.layout.width / this.tempBox.width), e = 0; e < 12; e++) {
                var n = Math.floor(e / t), o = e % t, i = cc.instantiate(this.tempBox);
                i.parent = this.layout, i.x = o * this.tempBox.width + (this.tempBox.width / 2 - this.layout.width / 2), 
                i.y = -n * this.tempBox.height - this.tempBox.height / 2;
                var a = i.getComponent(s.default);
                a.idx = e, this.boxs.push(a);
            }
            if (this.init(), GA.isWeChat() || GA.isQQ()) try {
                GA.PA && GA.PA.getOpenDataContext && GA.PA.getOpenDataContext().postMessage({
                    messageType: 13
                });
            } catch (t) {}
            if (this.schedule(function() {
                b.default.getInstance().load(Date.now());
            }, 1), x.default.getInstance().check(), I.default.getInstance().check(), P.default.getInstance().check(), 
            (M.GD.dailyInfo.length < k.GC.dailyRewardList.length || 0 == M.GD.dailyInfo[M.GD.dailyInfo.length - 1]) && !GA.isToday(M.GD.signLastTime)) switch (k.GC.isDaily) {
              case 1:
                M.GD.isNew || l.G.queue.push({
                    name: "daily",
                    type: 1
                });
                break;

              case 2:
                l.G.queue.push({
                    name: "daily",
                    type: 1
                });
            } else 1 == M.GD.dailyInfo[M.GD.dailyInfo.length - 1] && (this.dailyBtn.active = !1);
            D.ActivityManager.getInstance().checkActivity(D.ActivityType.NEWACTIVITY) ? M.GD.isNewActivityPop && l.G.queue.push({
                name: "newActivityBill",
                type: 1
            }) : D.ActivityManager.getInstance().checkActivity(D.ActivityType.NEWYEAR) ? M.GD.isNewYearPop && l.G.queue.push({
                name: "newYear",
                type: 1
            }) : D.ActivityManager.getInstance().checkActivity(D.ActivityType.CHRISTMAS) && M.GD.isChristmasPop && l.G.queue.push({
                name: "christmas",
                type: 1
            }), D.ActivityManager.getInstance().checkActivity(D.ActivityType.DIAMOND) && M.GD.diamondCount < k.GC.maxDiamondCount && l.G.queue.push({
                name: "eggsDiamond",
                type: 1
            });
        } catch (t) {
            console.error(t);
        }
    }, t.prototype.onEnable = function() {
        try {
            var t;
            for (this.layout.on(cc.Node.EventType.TOUCH_START, this.touchStart, this), this.layout.on(cc.Node.EventType.TOUCH_MOVE, this.touchMove, this), 
            this.layout.on(cc.Node.EventType.TOUCH_END, this.touchEnd, this), this.layout.on(cc.Node.EventType.TOUCH_CANCEL, this.touchEnd, this), 
            this.buyItem.refresh(), 2001 == M.GD.gunIdx && 3 != M.GD.personIdx && 9 != M.GD.personIdx && (M.GD.gunIdx = M.GD.topRank), 
            1008 == M.GD.gunIdx && -17 != M.GD.personIdx && (M.GD.gunIdx = M.GD.topRank), -1 < l.G.tryPersonIdx && l.G.tryPersonMap.has(l.G.tryPersonIdx) && l.G.tryPersonMap.get(l.G.tryPersonIdx).time < Date.now() && (M.GD.personIdx = M.GD.lastPersonIdx, 
            l.G.tryPersonIdx = -1), this.personView.init(), this.petView.initPet(), R.default.getInstance().barViews.forEach(function(t) {
                return t.refresh();
            }), this.levelView.refresh(M.GD.level), this.bgView.node.active || (this.bgView.node.active = !0), 
            -1 == C.default.getInstance().checkEggPet(0) && 0 == M.GD.petDataIdx && b.default.getInstance().isHas(0) && b.default.getInstance().getRealData().form < 2 ? cc.systemEvent.emit("eggs_bone", !0) : cc.systemEvent.emit("eggs_bone", !1), 
            (-1 < M.GD.backEquipIdx || -1 < M.GD.headEquipIdx) && cc.systemEvent.emit("equip_warn", !1), 
            this.curItem && (this.curItem.box.appendItem(this.curItem), this.curItem = null, 
            this.updateMatrix()), k.GC.isVaild(this.text + "_inter") || GA.isPlatform([ GA.Platform.OPPO, GA.Platform.Vivo ]) && T.default.getInstance().showInterstitialAd(this.text), 
            0 < l.G.queue.length && (1 == (t = l.G.queue.shift()).type ? R.default.getInstance().loadPnl(t.name) : 2 == t.type && R.default.getInstance().loadPopPnl(t.name, t.data)); 0 < l.G.christmasItems.length; ) (e = l.G.christmasItems.pop()).time > Date.now() && M.GD.christmasItems.push({
                idx: e.idx,
                time: e.time,
                isVideo: 0
            });
            for (var e, n, o = 0; o < M.GD.christmasItems.length; ) (n = M.GD.christmasItems[o]).time > Date.now() ? (this.appendChristmasItem(n), 
            o++) : M.GD.christmasItems.splice(o, 1);
            for (;0 < l.G.newYearItems.length; ) (e = l.G.newYearItems.pop()).time > Date.now() && M.GD.newYearItems.push({
                idx: e.idx,
                time: e.time,
                isVideo: 0
            });
            for (o = 0; o < M.GD.newYearItems.length; ) (n = M.GD.newYearItems[o]).time > Date.now() ? (this.appendNewYearItem(n), 
            o++) : M.GD.newYearItems.splice(o, 1);
            b.default.getInstance().check(), b.default.getInstance().load(Date.now()), this.checkAllEggs(), 
            1 == M.GD.gides[1] || k.GC.isGide && !M.GD.gides[0] || this.initGide();
        } catch (t) {
            console.error(t);
        }
    }, t.prototype.onDisable = function() {
        this.layout.off(cc.Node.EventType.TOUCH_START, this.touchStart, this), this.layout.off(cc.Node.EventType.TOUCH_MOVE, this.touchMove, this), 
        this.layout.off(cc.Node.EventType.TOUCH_END, this.touchEnd, this), this.layout.off(cc.Node.EventType.TOUCH_CANCEL, this.touchEnd, this), 
        R.default.getInstance().getPnl("gide").hidePnl(), this.curItem && (this.curItem.box.appendItem(this.curItem), 
        this.curItem = null, this.updateMatrix());
    }, t.prototype.onClickBuy = function() {
        var t, e;
        if (O.default.getInstance().sentLog("点击首页购买按键"), M.GD.money < this.buyItem.price) l.G.platform != l.Platform.XiaoDu ? (cc.log("金币不足"), 
        R.default.getInstance().loadPopPnl("money", {
            num: (l.G.getPrice(Math.max(M.GD.topRank - 2, 0)) + 500) * Math.max(1 - k.GC.money_reduce * M.GD.topRank, .001)
        })) : R.default.getInstance().showToast({
            str: "金币不足"
        }); else {
            var n = this.boxs.filter(function(t) {
                return t.isEmpty();
            });
            if (0 == n.length) return cc.log("栏位已满"), void (null === (e = null === (t = GA.PA) || void 0 === t ? void 0 : t.showToast) || void 0 === e || e.call(t, {
                title: "栏位已满",
                icon: "none"
            }));
            this.appendItem(this.buyItem.rank, n[0]) && (m.default.getInstance().playAudio("获得武器"), 
            M.GD.updateNumber("money", -this.buyItem.price), M.GD.count[this.buyItem.rank] ? M.GD.count[this.buyItem.rank]++ : M.GD.count[this.buyItem.rank] = 1, 
            this.buyItem.refresh(), this.updateMatrix(), R.default.getInstance().barViews.forEach(function(t) {
                return t.refresh();
            }), this.buyCount++, n = Math.floor(5 * Math.random()) + 5, this.buyCount > n && (this.buyCount = 0, 
            n = 4 < M.GD.topRank ? GA.rand(M.GD.topRank - 4, M.GD.topRank - 2) : 0, this.appendEquip(n, 1)), 
            this.checkAllEggs());
        }
    }, t.prototype.onClickQuit = function() {
        m.default.getInstance().playAudio("按钮2");
    }, t.prototype.onClickSet = function() {
        m.default.getInstance().playAudio("按钮2"), O.default.getInstance().sentLog("点击首页设置按键"), 
        R.default.getInstance().loadPnl("set", null, function() {
            R.default.getInstance().hideAllPnl();
        });
    }, t.prototype.onClickDaily = function() {
        m.default.getInstance().playAudio("按钮2"), O.default.getInstance().sentLog("点击首页签到按键"), 
        R.default.getInstance().loadPnl("daily", null, function() {
            T.default.getInstance().hideAllBanner(), R.default.getInstance().hideAllPnl();
        });
    }, t.prototype.onClickDraw = function() {
        m.default.getInstance().playAudio("按钮2"), O.default.getInstance().sentLog("点击首页抽奖按键"), 
        R.default.getInstance().loadPnl("draw", null, function() {
            R.default.getInstance().hideAllPnl();
        });
    }, t.prototype.onClickRank = function() {
        m.default.getInstance().playAudio("按钮2"), O.default.getInstance().sentLog("点击首页排行榜按键"), 
        -1 == l.G.seasoncount ? R.default.getInstance().showToast({
            str: "赛季未开始"
        }) : -2 == l.G.seasoncount ? R.default.getInstance().showToast({
            str: "赛季已结束"
        }) : R.default.getInstance().loadPnl("season", null, function() {
            cc.systemEvent.emit("level_warn", !1), T.default.getInstance().hideAllBanner(), 
            R.default.getInstance().hideAllPnl();
        });
    }, t.prototype.onClickSkin = function() {
        m.default.getInstance().playAudio("按钮2"), O.default.getInstance().sentLog("点击首页皮肤按键"), 
        R.default.getInstance().loadPnl("skin", null, function() {
            T.default.getInstance().hideAllBanner(), R.default.getInstance().hideAllPnl();
        }).then(function(t) {
            t instanceof d.default && t.showItem(u.SkinItemType.PERSON);
        });
    }, t.prototype.onClickPlay = function() {
        m.default.getInstance().playAudio("按钮2"), R.default.getInstance().preloadPnl("game2"), 
        O.default.getInstance().sentLog("点击首页开始游戏按键"), v.default.getInstance().matchType = v.MatchType.正常, 
        -1 < l.G.seasoncount && M.GD.seasonRewardTime < M.GD.seasonLastTime && !M.GD.isReward ? (cc.log("赛季奖励未领取"), 
        R.default.getInstance().loadPopPnl("season_reward")) : l.G.platform != l.Platform.XiaoDu ? !k.GC.isVaild("empty") && M.GD.petDataList.some(function(t, e) {
            return t && t.has && l.G.chargeList[e];
        }) && (k.GC.isCircle && !k.GC.isVaild("try") && M.GD.tryFailCount >= k.GC.cancelTryCount && (M.GD.topRank < l.G.gunModelList.length || M.GD.skins.length < l.G.personModelList.length) && (M.GD.emptyFailCount = 0, 
        M.GD.tryFailCount = 0), M.GD.emptyFailCount < k.GC.cancelEmptyCount) ? R.default.getInstance().loadPnl("empty") : !k.GC.isVaild("try") && M.GD.tryFailCount < k.GC.cancelTryCount && (M.GD.topRank < l.G.gunModelList.length || M.GD.skins.length < l.G.personModelList.length) ? R.default.getInstance().loadPopPnl("try") : v.default.getInstance().matchGame() : v.default.getInstance().matchGame();
    }, t.prototype.onClickBattle = function() {
        m.default.getInstance().playAudio("按钮2"), O.default.getInstance().sentLog("点击首页组队模式按键"), 
        R.default.getInstance().loadPnl("peak", null, function() {
            T.default.getInstance().hideAllBanner(), R.default.getInstance().hideAllPnl();
        });
    }, t.prototype.onClickSpeed = function() {
        m.default.getInstance().playAudio("按钮2"), O.default.getInstance().sentLog("点击首页加速按键"), 
        R.default.getInstance().loadPopPnl("speed");
    }, t.prototype.onClickShop = function() {
        m.default.getInstance().playAudio("按钮2"), O.default.getInstance().sentLog("点击首页商店按键"), 
        R.default.getInstance().loadPnl("shop", null, function() {
            T.default.getInstance().hideAllBanner(), R.default.getInstance().hideAllPnl();
        });
    }, t.prototype.onClickArm = function() {
        m.default.getInstance().playAudio("按钮2"), O.default.getInstance().sentLog("点击首页更换武器按键"), 
        R.default.getInstance().loadPnl("skin", null, function() {
            T.default.getInstance().hideAllBanner(), R.default.getInstance().hideAllPnl();
        }).then(function(t) {
            t instanceof d.default && t.showItem(u.SkinItemType.GUN);
        });
    }, t.prototype.onClickAir = function() {
        m.default.getInstance().playAudio("按钮2"), O.default.getInstance().sentLog("点击首页空投按键"), 
        R.default.getInstance().loadPopPnl("air");
    }, t.prototype.onClickOther = function() {
        m.default.getInstance().playAudio("按钮2"), O.default.getInstance().sentLog("点击首页显示导量按键");
    }, t.prototype.onClickShare = function() {
        O.default.getInstance().sentLog("点击首页一起玩按键"), GA.rewardOperation({
            tag: "",
            page: "",
            byVideo: !1,
            result: function() {}
        });
    }, t.prototype.onClickPet = function() {
        O.default.getInstance().sentLog("点击首页宠物按键"), M.GD.petDataList.some(t => t && t.has) ? b.default.getInstance().getRealHp() >= b.default.getInstance().getHp() || l.G.platform == l.Platform.XiaoDu ? R.default.getInstance().loadPnl("skin", null, () => {
            T.default.getInstance().hideAllBanner(), R.default.getInstance().hideAllPnl();
        }).then(t => {
            console.log(t), t instanceof d.default && t.showItem(u.SkinItemType.PET);
        }) : R.default.getInstance().loadPnl("pet") : (m.default.getInstance().playAudio("狗叫"), 
        R.default.getInstance().loadPnl("daily", null, () => {
            T.default.getInstance().hideAllBanner(), R.default.getInstance().hideAllPnl();
        }));
    }, t.prototype.onClickNotice = function() {
        m.default.getInstance().playAudio("按钮2"), O.default.getInstance().sentLog("点击首页公告按键"), 
        R.default.getInstance().loadPnl("notice");
    }, t.prototype.onClickSeason = function() {
        m.default.getInstance().playAudio("按钮2"), O.default.getInstance().sentLog("点击首页赛季按键"), 
        -1 == l.G.seasoncount ? R.default.getInstance().showToast({
            str: "赛季未开始"
        }) : -2 == l.G.seasoncount ? R.default.getInstance().showToast({
            str: "赛季已结束"
        }) : R.default.getInstance().loadPnl("season", null, function() {
            T.default.getInstance().hideAllBanner(), R.default.getInstance().hideAllPnl();
        });
    }, t.prototype.start = function() {
        var e = this;
        try {
            m.default.getInstance().playBg("背景"), GA.isPlatform([ GA.Platform.ByteDance, GA.Platform.Kwaigame ]) && this.scheduleOnce(function() {
                G.default.getInstance().init();
            }, 1), this.personView.init(), this.petView.initPet(), k.GC.isGide && !M.GD.gides[0] && (l.G.tryGunIdx = 10, 
            v.default.getInstance().matchType = v.MatchType.引导, v.default.getInstance().gideGame()), 
            4 < M.GD.topRank && (this.randCount = 10 + Math.floor(10 * Math.random())), l.G.platform != l.Platform.XiaoDu && (R.default.getInstance().preloadPnl("try"), 
            this.schedule(function() {
                e.air.setPosition(cc.v2(-450, 800));
                var t = e.air.getComponent(sp.Skeleton);
                t && t.setAnimation(0, "animation", !0), cc.tween(e.air).to(16, {
                    position: cc.v3(-450, -800)
                }).call(function() {
                    e.air.setPosition(cc.v2(-1200, 0)), t && t.clearTracks();
                }).start();
            }, GA.rand(k.GC.airMinInterval, k.GC.airMaxInterval))), 0 < M.GD.topRank && k.GC.hints[2] && this.schedule(this.initHintThree, k.GC.hintInterval), 
            this.updateMatrix();
        } catch (t) {
            console.error(t);
        }
    }, t.prototype.init = function() {
        for (var n = this, t = 0; t < M.GD.matrix.length; ) {
            var e, o, i = M.GD.matrix[t];
            i < 2e3 && (i < 0 || 1e3 <= i) ? (e = l.G.getEggIdx(i), C.default.getInstance().eggDataMap.has(e) ? (o = C.default.getInstance().getDataGun(e)) && o.time + 1e3 * k.GC.eggTime - Date.now() <= 0 ? (o.time = 0, 
            C.default.getInstance().setDataGun(e, o), M.GD.gunIdx == i && (M.GD.gunIdx = M.GD.topRank), 
            M.GD.matrix.splice(t, 1)) : t++ : M.GD.matrix.splice(t, 1)) : t++;
        }
        M.GD.matrix.forEach(function(t, e) {
            null != t && !isNaN(t) && t >= -k.GC.maxEggIdx - 1 && e < n.boxs.length && n.appendItem(t, n.boxs[e]);
        });
    }, t.prototype.touchStart = function(t) {
        var e = this, n = cc.v2(t.getLocation()), o = this.getBoxs(n);
        0 < o.length && ((t = o[0].item) && !t.isEffect && (this.curItem = t, this.curItem.node.parent = this.node, 
        this.curItem.node.setPosition(this.node.convertToNodeSpaceAR(n)), this.boxs.forEach(function(t) {
            t.item && t != o[0] && !t.item.isEffect && t.item.check(e.curItem) && t.showLight();
        }), cc.log("show delBtn"), this.delBtn.active = !0, cc.Tween.stopAllByTarget(this.delBtn), 
        this.delBtn.scale = 0, cc.tween(this.delBtn).to(.2, {
            scale: 1
        }).start()));
    }, t.prototype.touchMove = function(t) {
        this.curItem && (t = t.getLocation(), this.curItem.node.setPosition(this.node.convertToNodeSpaceAR(t)));
    }, t.prototype.touchEnd = function(t) {
        var e, n;
        if (this.curItem) {
            var o = cc.v2(t.getLocation());
            this.boxs.forEach(function(t) {
                return t.hideLight();
            });
            t = this.getBoxs(o);
            if (0 < t.length) this.switchItem(this.curItem, t[0]); else {
                cc.log("resume");
                t = this.delBtn.getBoundingBoxToWorld();
                if ((this.curItem.type == c.GunType.DEFAULT || this.curItem.type == c.GunType.DRAW) && o.x > t.x && o.x < t.x + t.width && o.y > t.y && o.y < t.y + t.height) {
                    if (this.curItem.box.removeItem(), this.curItem.type == c.GunType.DEFAULT ? M.GD.updateNumber("money", Math.ceil(.8 * l.G.getPrice(this.curItem.rank, Math.max(l.G.getCount(this.curItem.rank) - 1, 0)))) : this.curItem.type == c.GunType.DRAW && M.GD.updateNumber("money", Math.ceil(.8 * l.G.getPrice(this.curItem.rank + 42, Math.max(l.G.getCount(this.curItem.rank + 42) - 1, 0)))), 
                    this.curItem.node.destroy(), this.updateMatrix(), this.checkAllEggs(), R.default.getInstance().barViews.forEach(function(t) {
                        return t.refresh();
                    }), 0 < this.equips.length) for (var i = this.boxs.filter(function(t) {
                        return t.isEmpty();
                    }); 0 < i.length && 0 < this.equips.length; ) this.equips.pop().init({
                        box: i[0]
                    }), i = this.boxs.filter(function(t) {
                        return t.isEmpty();
                    });
                } else {
                    this.curItem.box.resumeItem();
                    t = this.personView.node.getBoundingBoxToWorld();
                    o.x > t.x && o.x < t.x + t.width && o.y > t.y && o.y < t.y + t.height && (this.curItem.type == c.GunType.DEFAULT ? M.GD.gunIdx = this.curItem.rank : this.curItem.type == c.GunType.EGGS ? 8 != this.curItem.rank || -17 == M.GD.personIdx ? M.GD.gunIdx = this.curItem.rank + 1e3 : null === (e = null === (n = GA.PA) || void 0 === n ? void 0 : n.showToast) || void 0 === e || e.call(n, {
                        title: "只有杉斯才可以使用龙骨炮",
                        icon: "none"
                    }) : this.curItem.type == c.GunType.DRAW && (1 != this.curItem.rank || 3 == M.GD.personIdx || 9 == M.GD.personIdx ? M.GD.gunIdx = this.curItem.rank + 2e3 : null === (n = null === (e = GA.PA) || void 0 === e ? void 0 : e.showToast) || void 0 === n || n.call(e, {
                        title: "只有忍者才可以使用手里剑",
                        icon: "none"
                    })), this.personView.changeGun(M.GD.gunIdx));
                }
            }
            this.curItem = null, this.delBtn.active = !1;
        }
    }, t.prototype.appendEquip = function(t, e) {
        void 0 === e && (e = 0), isNaN(t) && (t = 0);
        var n = cc.instantiate(this.tempEquip).getComponent(h.default), o = this.boxs.filter(function(t) {
            return t.isEmpty();
        });
        0 == o.length ? (n.init({
            type: e,
            rank: t
        }), this.equips.push(n)) : n.init({
            type: e,
            rank: t,
            box: o[0]
        });
    }, t.prototype.appendItem = function(t, e) {
        isNaN(t) && (t = 0);
        var n = cc.instantiate(this.tempItem).getComponent(c.default);
        return n ? (3e3 <= t ? (n.rank = t - 3e3, n.type = c.GunType.OLYMPIC) : 2e3 <= t ? (n.rank = t - 2e3, 
        n.type = c.GunType.DRAW) : 1e3 <= t ? (n.rank = t - 1e3, n.type = c.GunType.EGGS) : t < 0 ? (n.rank = -t - 1, 
        n.type = c.GunType.EGGS) : n.rank = t, e.appendItem(n), n.refresh(), n.show(), n) : null;
    }, t.prototype.appendChristmasItem = function(e) {
        var t, n;
        this.christmasItems.some(function(t) {
            return t.data.idx == e.idx;
        }) || this.boxs.some(function(t) {
            return t.christmasItem && t.christmasItem.data.idx == e.idx;
        }) || (t = cc.instantiate(this.tempChristmasItem).getComponent(_.default), 0 == (n = this.boxs.filter(function(t) {
            return t.isEmpty();
        })).length ? (t.init({
            data: e
        }), this.christmasItems.push(t)) : t.init({
            data: e,
            box: n[0]
        }));
    }, t.prototype.appendNewYearItem = function(e) {
        var t, n;
        this.newYearItems.some(function(t) {
            return t.data.idx == e.idx;
        }) || this.boxs.some(function(t) {
            return t.newYearItem && t.newYearItem.data.idx == e.idx;
        }) || (t = cc.instantiate(this.tempNewYearItem).getComponent(A.default), 0 == (n = this.boxs.filter(function(t) {
            return t.isEmpty();
        })).length ? (t.init({
            data: e
        }), this.newYearItems.push(t)) : t.init({
            data: e,
            box: n[0]
        }));
    }, t.prototype.switchItem = function(t, e) {
        var n, o = this, i = e.item;
        if (e.isEmpty()) cc.log("move"), t.box.item = null, t.box.refresh(), e.appendItem(t), 
        this.updateMatrix(), this.checkAllEggs(); else if (i && i != t && !i.isEffect) if (t.check(i)) {
            if (cc.log("combine"), v.default.getInstance().level = 0, M.GD.finishGide(1) && (n = R.default.getInstance().getPnl("gide"), 
            O.default.getInstance().sentLog("引导合成完成"), n.stopGide()), this.checkExp(i, t) || i.combine(t, function() {
                o.updateMatrix();
            }), this.checkAllEggs(), 0 < this.equips.length) for (var a = this.boxs.filter(function(t) {
                return t.isEmpty();
            }); 0 < a.length && 0 < this.equips.length; ) this.equips.pop().init({
                box: a[0]
            }), a = this.boxs.filter(function(t) {
                return t.isEmpty();
            });
        } else t.rank == i.rank && t.rank == l.G.gunModelList.length - 1 ? R.default.getInstance().loadPnl("hbCombine2").then(function() {
            t.box.resumeItem();
        }) : (cc.log("switch"), this.curItem.box.appendItem(i), e.appendItem(this.curItem), 
        this.updateMatrix(), this.checkAllEggs()); else cc.log("resume"), t.box.resumeItem();
    }, t.prototype.checkExp = function(t, e) {
        var n = this;
        if (t.rank == M.GD.topRank && M.GD.topRank < l.G.gunModelList.length) return M.GD.topRank++, 
        -1 != M.GD.gunIdx && (M.GD.gunIdx = M.GD.topRank, this.personView.changeGun(M.GD.gunIdx)), 
        t.combine(e, function() {
            n.updateMatrix();
        }, !1), l.G.platform == l.Platform.H4399 ? 10 < M.GD.topRank || M.GD.topRank % 5 == 0 ? S.default.getInstance().upload() : S.default.getInstance().save() : S.default.getInstance().upload({
            json: !0,
            local: !0,
            compose: M.GD.topRank
        }), R.default.getInstance().loadPopPnl("combine", {
            item: t
        }), !0;
        if (0 == this.randCount && (this.randCount = 5 + Math.floor(10 * Math.random())), 
        this.combineCount++, this.combineCount == this.randCount) {
            if (this.combineCount = 0, this.randCount = 5 + Math.floor(10 * Math.random()), 
            4 < M.GD.topRank && 3 < M.GD.topRank - t.rank) return t.combine(e, function() {
                n.updateMatrix();
            }, !1), R.default.getInstance().loadPopPnl("up", {
                item: t
            }), !0;
            if (4 < M.GD.topRank - t.rank || t.rank < 4 && t.rank < M.GD.topRank) return t.combine(e, function() {
                n.updateMatrix();
            }, !1), R.default.getInstance().loadPopPnl("exp", {
                item: t
            }), !0;
        }
        return !1;
    }, t.prototype.checkAllEggs = function() {
        this.checkEggs(0) ? this.doEggs(0) : this.checkEggs(1, [ null, 6, 6, null, 6, null, null, 6, null, 6, 6, null ]) ? this.doEggs(1) : this.checkEggs(2, [ 10, 10, 10, null, 10, null, 10, null, 10, 10, 10, null ]) ? this.doEggs(2) : this.checkEggs(3, [ 5, 5, 5, 5, 5, null, null, 5, 5, 5, 5, 5 ]) ? this.doEggs(3) : this.checkEggs(4, [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]) ? this.doEggs(4) : this.checkEggs(5, [ 9, null, null, null, 9, 9, 9, 9, null, 9, null, 9 ]) ? this.doEggs(5) : this.checkEggs(6, [ null, 6, 6, null, 6, 6, 6, 6, null, 6, 6, null ]) && this.doEggs(6);
    }, t.prototype.checkEggs = function(t, n) {
        var o = this;
        if (void 0 === t && (t = 0), void 0 === n && (n = [ 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12 ]), 
        0 <= C.default.getInstance().checkEggGun(t) || -2 == C.default.getInstance().checkEggGun(t)) return !1;
        var i = 0;
        return this.deleteBoxs = [], this.boxs.forEach(function(t, e) {
            e < n.length && (null == n[e] ? t.item || t.equip || i++ : t.item && t.item.rank == n[e] && (o.deleteBoxs.push(t), 
            i++));
        }),  i == n.length;
    }, t.prototype.doEggs = function(t) {
        var e;
        void 0 === t && (t = 0), -1 == C.default.getInstance().checkEggGun(t) && (O.default.getInstance().sentLog("获得武器彩蛋id:" + t), 
        C.default.getInstance().updateEggGun(t), (e = C.default.getInstance().getDataGun(t)) && (e.time = Date.now() + 1e3 * k.GC.eggTime, 
        C.default.getInstance().setDataGun(t, e)), M.GD.gunIdx = t + 1e3, this.personView.changeGun(M.GD.gunIdx), 
        this.deleteBoxs.forEach(function(t) {
            return t.removeItem();
        }), this.deleteBoxs = [], 0 < (e = this.boxs.filter(function(t) {
            return t.isEmpty();
        })).length ? (this.appendItem(M.GD.gunIdx, e[0]), this.updateMatrix()) : this.appendEquip(M.GD.gunIdx), 
        S.default.getInstance().save(), 4 < t ? R.default.getInstance().loadPopPnl("egg_reward", {
            type: l.RewardType.ARM,
            idx: M.GD.gunIdx,
            scale: 1.6
        }) : R.default.getInstance().loadPopPnl("egg_combine"));
    }, t.prototype.getBoxs = function(t) {
        var e = cc.v2(this.layout.convertToNodeSpaceAR(t));
        return this.boxs.filter(function(t) {
            return Math.abs(t.node.x - e.x) < t.node.width / 2 && Math.abs(t.node.y - e.y) < t.node.height / 2;
        });
    }, t.prototype.getProfit = function() {
        return 0 < this.profitPool.size() ? this.profitPool.get() : cc.instantiate(this.profitLabel.node);
    }, t.prototype.getCombine = function() {
        return 0 < this.combinePool.size() ? this.combinePool.get() : cc.instantiate(this.combineSkeleton.node);
    }, t.prototype.updateMatrix = function() {
        var n = 0;
        this.boxs.forEach(function(t, e) {
            t.item ? t.item.type == c.GunType.EGGS ? M.GD.matrix[e] = t.item.rank + 1e3 : t.item.type == c.GunType.DRAW ? M.GD.matrix[e] = t.item.rank + 2e3 : (M.GD.matrix[e] = t.item.rank, 
            n += l.G.getProfit(t.item.rank)) : M.GD.matrix[e] = -100;
        }), l.G.profit = n, S.default.getInstance().save({
            interval: 5e3
        });
    }, t.prototype.parseTime = function(t) {
        var e = "", n = Math.floor(t / 60);
        e += n < 10 ? "0" + n : n;
        t %= 60;
        return (e += ":") + (t < 10 ? "0" + t : t);
    }, t.prototype.initGide = function() {
        var e, t, n, o, i, a = this;
        0 == M.GD.gides[1] ? ((e = R.default.getInstance().getPnl("gide")).showPnl(), t = new w.default({
            target: this.buyItem.node,
            key: "gide1",
            type: cc.Node.EventType.TOUCH_END,
            callback: function() {
                e.init([ a.buyItem.node.convertToWorldSpaceAR(cc.Vec2.ZERO) ], !0), e.showGide(!0), 
                e.showCircle();
            }
        }), n = new w.default({
            target: this.buyItem.node,
            key: "gide2",
            type: cc.Node.EventType.TOUCH_END,
            callback: function() {
                e.init([ a.buyItem.node.convertToWorldSpaceAR(cc.Vec2.ZERO) ], !0), e.showGide(!0), 
                e.showCircle();
            }
        }), o = new w.default({
            key: "gide3",
            callback: function() {
                M.GD.gides[1] = 2;
                var t = a.boxs[0].node.convertToWorldSpaceAR(cc.Vec2.ZERO);
                e.init([ t ], !1), e.showGide(!1), e.hideCircle(), cc.tween(e.gides[0].node).repeatForever(cc.tween().call(function() {
                    e.gides[0].node.setPosition(e.node.convertToNodeSpaceAR(t));
                }).delay(.5).by(1, {
                    position: cc.v2(150, 0)
                }).delay(.5)).start();
            }
        }), (t.next = n).next = o, t.run()) : 2 == M.GD.gides[1] && ((i = R.default.getInstance().getPnl("gide")).showPnl(), 
        (o = new w.default({
            key: "gide3",
            callback: function() {
                var t = a.boxs[0].node.convertToWorldSpaceAR(cc.Vec2.ZERO);
                i.init([ t ], !1), i.showGide(!1), i.hideCircle(), cc.tween(i.gides[0].node).repeatForever(cc.tween().call(function() {
                    i.gides[0].node.setPosition(i.node.convertToNodeSpaceAR(t));
                }).delay(.5).by(1, {
                    position: cc.v2(150, 0)
                }).delay(.5)).start();
            }
        })).run());
    }, t.prototype.initHintOne = function() {
        var t, e = this;
        k.GC.hints[0] && ((t = R.default.getInstance().getPnl("gide")).showPnl(), new w.default({
            target: this.startBtn.node,
            key: "hint1",
            type: cc.Node.EventType.TOUCH_END,
            callback: function() {
                t.init([ e.startBtn.node.convertToWorldSpaceAR(cc.Vec2.ZERO) ], !0), t.showGide(!0), 
                t.showCircle();
            },
            complete: function() {
                t.hideGide();
            }
        }).run());
    }, t.prototype.initHintTwo = function() {
        var t, e = this;
        k.GC.hints[1] && ((t = R.default.getInstance().getPnl("gide")).showPnl(), new w.default({
            target: this.startBtn.node,
            key: "hint2",
            type: cc.Node.EventType.TOUCH_END,
            callback: function() {
                t.init([ e.startBtn.node.convertToWorldSpaceAR(cc.Vec2.ZERO) ], !1), t.showGide(!1), 
                t.showCircle(), t.unschedule(t.hideGide), t.scheduleOnce(t.hideGide, 3);
            },
            complete: function() {
                t.stopGide();
            }
        }).run());
    }, t.prototype.initHintThree = function() {
        var t, e, n = this;
        k.GC.hints[2] && ((t = R.default.getInstance().getPnl("gide")).showPnl(), e = this.boxs.filter(function(t) {
            return t.isEmpty();
        }), (M.GD.money < this.buyItem.price || 0 == e.length ? new w.default({
            target: this.startBtn.node,
            key: "hint3",
            type: cc.Node.EventType.TOUCH_END,
            callback: function() {
                t.init([ n.startBtn.node.convertToWorldSpaceAR(cc.Vec2.ZERO) ], !1), t.showGide(!1), 
                t.showCircle(), t.unschedule(t.hideGide), t.scheduleOnce(t.hideGide, 3);
            },
            complete: function() {
                t.stopGide();
            }
        }) : new w.default({
            target: this.buyItem.node,
            key: "hint3",
            type: cc.Node.EventType.TOUCH_END,
            callback: function() {
                t.init([ n.buyItem.node.convertToWorldSpaceAR(cc.Vec2.ZERO) ], !1), t.showGide(!1), 
                t.showCircle(), t.unschedule(t.hideGide), t.scheduleOnce(t.hideGide, 3);
            },
            complete: function() {
                t.stopGide();
            }
        })).run());
    }, t.prototype.initSeasonAction = function(t) {
        var e = cc.instantiate(t);
        e.parent = this.node;
        t = this.node.convertToNodeSpaceAR(this.levelView.node.convertToWorldSpaceAR(cc.Vec2.ZERO));
        cc.tween(e).to(.5, {
            position: cc.v3(t),
            scale: .4
        }).call(function() {
            var t;
            e.destroy(), 0 < l.G.queue.length && (1 == (t = l.G.queue.shift()).type ? R.default.getInstance().loadPnl(t.name) : 2 == t.type && R.default.getInstance().loadPopPnl(t.name));
        }).start();
    }, a([ V(cc.Node) ], t.prototype, "tempBox", void 0), a([ V(cc.Node) ], t.prototype, "tempItem", void 0), 
    a([ V(cc.Node) ], t.prototype, "tempEquip", void 0), a([ V(cc.Node) ], t.prototype, "tempChristmasItem", void 0), 
    a([ V(cc.Node) ], t.prototype, "tempNewYearItem", void 0), a([ V(cc.Node) ], t.prototype, "layout", void 0), 
    a([ V(cc.Node) ], t.prototype, "air", void 0), a([ V(cc.Node) ], t.prototype, "top", void 0), 
    a([ V(cc.Node) ], t.prototype, "bottom", void 0), a([ V(cc.Label) ], t.prototype, "profitLabel", void 0), 
    a([ V(sp.Skeleton) ], t.prototype, "combineSkeleton", void 0), a([ V(cc.Button) ], t.prototype, "startBtn", void 0), 
    a([ V(cc.Node) ], t.prototype, "delBtn", void 0), a([ V(cc.Node) ], t.prototype, "dailyBtn", void 0), 
    a([ V(f.default) ], t.prototype, "levelView", void 0), a([ V(p.default) ], t.prototype, "personView", void 0), 
    a([ V(p.default) ], t.prototype, "petView", void 0), a([ V(g.default) ], t.prototype, "bgView", void 0), 
    a([ V(y.default) ], t.prototype, "gideView", void 0), a([ V(r.default) ], t.prototype, "buyItem", void 0), 
    a([ E ], t);
}(d.default);

n.default = N;